<?php

namespace App\Providers;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    public function boot()
    {
        if (app()->environment('local')) {
            if (collect($_GET)->has('sql-debug')) {
                DB::listen(function ($query) {
                    dump($query->sql, $query->bindings);
                });
            }
        }
    }
}
